﻿var treeCurObj;
function TreeShow(e)
{
	treeCurObj=e;
	sDropName=e.drop;
	DropOjbAdd(e.drop);
	pt=fGetXY(document.getElementById(e.id));
	var width=e.width;
	if(!width) width=$("#"+e.id).width();
    var height=e.height;
    if(!height) height=$("#"+e.drop).height();
	var value="";
	if(e.valueId) value=$("#"+e.valueId).val();

	if($("#"+e.drop).is(":hidden")) {
        $("#" + e.drop).show().css({
            "top": pt.top,
            "left": pt.left,
            "width": width,
            "height":height
        }).prop("src", "../Main/TreeDrop.htm?treeType=" + e.treeType + "&type=" + e.type + "&para=" + e.para + "&value=" + value);
    }
}
function TreeReturn(nodes)
{
	
	var name="";
	var id="";
	if(typeof nodes.length=="number")
	{
		for(var i=0;i<nodes.length;i++)
		{
			if(!nodes[i].isParent&&nodes[i].id>0){
				name+=","+nodes[i].name;
				id+=","+nodes[i].id;
			}
		}
		if(name!="") name=name.substring(1);
		if(id!="") id=id.substring(1);
	}
	else
	{
		if(nodes.id>0)			    	
   		{		
			name=nodes.name;
			id=nodes.id;
   		}
		else
			return;
	}	
	
	$("#"+treeCurObj.id).val(name);
	$("#"+treeCurObj.valueId).val(id);
	$("#"+treeCurObj.drop).hide();
}